package org.example.feign;

import org.example.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigInteger;

/**
 * 权限服务远程调用接口
 * 用于通过RPC调用权限服务
 */
@FeignClient(value = "permission-service")
public interface PermissionServiceFeignClient {

    /**
     * 绑定默认角色
     *
     * @param userId 用户ID
     */
    @PostMapping("/permission/bindDefaultRole")
    Result bindDefaultRole(@RequestParam("userId") BigInteger userId);

    /**
     * 获取用户角色编码
     *
     * @param userId 用户ID
     * @return 角色编码
     */
    @GetMapping("/permission/getUserRoleCode")
    String getUserRoleCode(@RequestParam("userId") BigInteger userId);

    /**
     * 升级为管理员
     *
     * @param targetUserId 目标用户ID
     * @param currentUserId 当前用户ID
     */
    @PostMapping("/permission/upgradeToAdmin")
    Result upgradeToAdmin(@RequestParam BigInteger targetUserId, @RequestParam BigInteger currentUserId);


    /**
     * 降级为普通用户
     *
     * @param targetUserId 降级用户ID
     * @param currentUserId 当前用户ID
     */
    @PostMapping("/permission/downgradeToUser")
    Result downgradeToUser(@RequestParam BigInteger targetUserId, @RequestParam BigInteger currentUserId);

    /**
     * 绑定超级管理员角色
     *
     * @param userId 用户ID
     */
    @PostMapping("/permission/bindSuperAdminRole")
    Result bindSuperAdminRole(@RequestParam("userId") BigInteger userId);
}

